package com.wbs.shop.nuby.view.adapter;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.recyclerview.widget.RecyclerView;

import com.wbs.shop.nuby.R;
import com.wbs.shop.nuby.bean.EmployeeBean;
import com.wbs.shop.nuby.bean.PayModeBean;
import com.wbs.shop.nuby.utils.StringUtils;
import com.wbs.shop.nuby.view.base.BaseRecyclerAdapter;

import butterknife.BindView;
import butterknife.ButterKnife;

public class SelectEmployeeAdapter extends BaseRecyclerAdapter<SelectEmployeeAdapter.ViewHolder, EmployeeBean> {
    public SelectEmployeeAdapter(Context mContext) {
        super(mContext);
    }

    @Override
    public int getItemLoayoutId() {
        return R.layout.item_select_employee;
    }

    @Override
    public ViewHolder onCreateViewHolder(View rootView, int viewType) {
        return new ViewHolder(rootView);
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, EmployeeBean bean, int position) {
        holder.tvUserName.setText(StringUtils.defaultIfEmpty(bean.getUserName(), ""));
        holder.tvUserMobile.setText(StringUtils.defaultIfEmpty(bean.getMobile(), ""));
        holder.itemView.setTag(position);
        holder.itemView.setOnClickListener(this::onClickAdapter);
    }

    static class ViewHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.tvUserName)
        TextView tvUserName;
        @BindView(R.id.tvUserMobile)
        TextView tvUserMobile;

        ViewHolder(View view) {
            super(view);
            ButterKnife.bind(this, view);
        }
    }
}
